﻿/*
 * NetUdpConnection.h
 *
 */
#ifndef __GDK_NETUDPCONNECTION_H__
#define __GDK_NETUDPCONNECTION_H__

#include <gdk/net/Socket.h>
#include <gdk/net/UdpStream.h>
#include <gdk/net/NetConnection.h>


namespace gdk
{



	//////////////////////////////////////////////////
	class GDK_NET_EXPORT NetUdpConnection : public UdpStream, public NetConnection
	{
		DECLARE_CLASS_HANDLE(NetUdpConnection)
		DECLARE_CLASS_INSTANCE(NetUdpConnection)

	private:
		bool	_error;


	private:
		NetUdpConnection(void);
		~NetUdpConnection(void);

	public:
		virtual void onTick(uint32_t timeSinceLastTick);
		virtual void onSend(void);
		virtual void close(void);
		virtual Uuid getPeerSocketId(void) const { return UdpStream::getPeerSocketId(); }
		//--------------------------------------------

	public:
		__INLINE__ bool  isConnected(void) const { return getConnectionState() == CONNECTED; }
		//--------------------------------------------
	};
	typedef NetUdpConnection::Handle	NetUdpConnectionPtr;


} //namespace gdk


#endif //__GDK_NETUDPCONNECTION_H__
